//
//  DSKeyboard.h
//  ANYpocket
//
//  Created by wkun on 2019/10/1.
//  Copyright © 2019 bill. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@protocol DSKeyboardDelegate;

@interface DSKeyboard : NSObject

@property (nonatomic, weak) id<DSKeyboardDelegate> delegate;

/// 当前键盘对应的UITextField 或者UITextView，又调用方设置
/// 当一个页面有多个输入框时，为了临时存储正在输入的文本框
@property (nonatomic, weak) UIView * _Nullable textField;

@property (nonatomic, assign, readonly) double keyBoardHeight;

/// 是否正在展示键盘
@property (nonatomic, assign, readonly) BOOL isShowingKeyboard;

/**
 *  监听键盘消失和出现
 */
-(void)addObserverKeyBoard;
/**
 *  当本实例销毁时，一定要移除监听。
 */
-(void)removeObserver;

@end

@protocol DSKeyboardDelegate <NSObject>

@optional

/**
 *  键盘将要出现。此时，键盘高度已取到。
 *
 *  @param keyBoard 本实例
 */
- (void)keyBoardWillShow:(DSKeyboard*)keyBoard keyBoardHeight:(CGFloat)height;

/**
 *  键盘消失。
 *
 *  @param keyBoard 本实例
 */
- (void)keyBoardWillHide:(DSKeyboard*)keyBoard keyBoardHeight:(CGFloat)height;

/**
 键盘完全弹出
 @param keyBoard 本实例
 */
- (void)keyBoardDidShow:(DSKeyboard*)keyBoard ;

@end

NS_ASSUME_NONNULL_END
